<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">
    <title>辕古千年后台</title>
    <!-- Bootstrap core CSS -->
    <link href="{{asset('/layui.css')}}" rel="stylesheet" media="all">
    <link rel="stylesheet" href="{{asset('/bootstrap.min.css')}}">
    <link rel="stylesheet" href="{{asset('/dashboard.css')}}">
    <link rel="stylesheet" href="{{asset('/bootstrap-theme.min.css')}}">
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="{{asset('jquery.js')}}"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="{{asset('/bootstrap.min.js')}}"></script>
    <style>
        th{
            text-align: center;
        }
        tr{
            text-align: center;
        }
    </style>
</head>
<body>

<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">辕古千年后台</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">辕古千年后台</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-right">
                <li><a href="javascript:;">{{session("admin_name")}}，欢迎您</a></li>
                <li><a href="/adminLogout" style="color: red">退出</a></li>
            </ul>
        </div>
    </div>
</nav>

<div class="container-fluid">
    <div class="row">
        @include('admin.leftNav')
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <h2 class="page-header">门派管理 | <button type="button" class="btn btn-primary  btn-sm" data-toggle="modal" data-target="#addAD">添加门派</button></h2>
            <div class="modal fade bs-example-modal-lg" id="addAD" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog modal-lg">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                            <h4 class="modal-title" id="myModalLabel">添加门派</h4>
                        </div>
                        <div class="modal-body">
                            <form  action="/addGameMP" method="post">
                                <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                <h5>攻略标题</h5>
                                <input type="text"  name="game_mp_name" class="form-control" placeholder="门派名称"  required autofocus><br>
                                <h5>门派层级</h5>
                                <select name="game_mp_floor" class="form-control" style="width: 300px">
                                    <option value="1">一层</option>
                                    <option value="2">二层</option>
                                    <option value="3">三层</option>
                                </select>
                                <h5>门派内容</h5>
                                <div id="editor"></div>
                                <input  name="game_mp_info" id="text1" type="hidden">
                                <!-- 注意， 只需要引用 JS，无需引用任何 CSS ！！！-->
                                <script type="text/javascript" src="{{asset('/wangEditor.min.js')}}"></script>
                                <script type="text/javascript" >
                                    var E = window.wangEditor
                                    var editor = new E('#editor')
                                    // 或者 var editor = new E( document.getElementById('editor') )
                                    var $text1 = $('#text1')
                                    editor.customConfig.onchange = function (html) {
                                        // 监控变化，同步更新到 textarea
                                        $text1.val(html)
                                    }
                                    editor.customConfig.uploadImgShowBase64 = true   // 使用 base64 保存图片

                                    editor.customConfig.showLinkImg = false
                                    editor.customConfig.debug = location.href.indexOf('wangeditor_debug_mode=1') > 0
                                    editor.create()
                                    // 初始化 textarea 的值
                                    $text1.val(editor.txt.html())
                                </script>
                        </div>
                        <div class="modal-footer">
                            <button type="submit" class="btn btn-primary">添加</button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">返回</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            @if(session('__Ajax_RedirectFunc_status') == true)
                <div>
                    <div class="alert alert-success alert-dismissible fade in" role="alert">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                        <h3>成功</h3>
                        <p><?php echo session('__Ajax_RedirectFunc_message');?></p>
                        <p><?php echo session('__Ajax_RedirectFunc_plugin');?></p>
                    </div>
                </div>
            @endif
            @if(session('__Ajax_RedirectFunc_status') === false)
                <div >
                    <div class="alert alert-danger alert-dismissible fade in" role="alert">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                        <h3>失败</h3>
                        <p><?php echo session('__Ajax_RedirectFunc_message');?></p>
                        <p><?php echo session('__Ajax_RedirectFunc_plugin');?></p>
                    </div>
                </div>
            @endif
            <div class="panel-body" >
                <!--表格-->
                <div class="table-responsive">
                    <table class="table table-bordered table-responsive table-striped table-hover">
                        <thead>
                        <tr>
                            <th>时间</th>
                            <th>标题</th>
                            <th>层级</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($gameMPData as $data)
                            <tr>
                                <td scope="row">{{$data->game_mp_time}}</td>
                                <td>{{$data->game_mp_name}}</td>
                                <td>{{$data->game_mp_floor}}</td>
                                <td><a href="/gameMPInfo/{{$data->game_mp_id}}" class="btn btn-info btn-sm">详情</a>
                                    <button type="button" class="btn btn-danger  btn-sm" data-toggle="modal" data-target="#delAd{{$data->game_mp_id}}">删除</button></td>
                                <!--删除种类模态框-->
                                <div class="modal fade" id="delAd{{$data->game_mp_id}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                                <h4 class="modal-title" id="myModalLabel2">警告</h4>
                                            </div>
                                            <div class="modal-body">
                                                <form action="/delGameMP" method="get">
                                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                                    <input type="hidden" name="game_mp_id" value="{{$data->game_mp_id}}">
                                                    <h4>确定要删除吗？</h4>
                                            </div>
                                            <div class="modal-footer">
                                                <button type="submit" class="btn btn-danger">删除</button>
                                                <button type="button" class="btn btn-default" data-dismiss="modal">返回</button>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                    <hr>
                    <div class="bs-example" data-example-id="disabled-active-pagination">
                        <nav aria-label="...">
                            <ul class="list text-center">
                                {{$gameMPData->links()}}
                            </ul>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>